package com.shop.www.service;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class Demo01 extends HttpServlet{
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        String idstr= request.getParameter("id");
        String name = request.getParameter("name");
        String age = request.getParameter("age");
        Integer id = Integer.parseInt(idstr);
        System.out.println(id+" "+name+" "+age);

        //会话
        //Object o = Basicdao.update("INSERT INTO t14(id,`name`,age) VALUES(null,?,?)",name,age);
        //System.out.println(o);

        /*HttpSession session = request.getSession();
        System.out.println(session.getId());
        session.setAttribute("name","fxab");*/

        //服务器内转发和客户端重定向
        //request.getRequestDispatcher("Demo03").forward(request,response);
        //response.sendRedirect("Demo03");
    }
}
